package org.example.exception;

import org.example.Student;

public class Main {
    public static void main(String[] args) {
//        int[] arr=new int[]{1,2,3};
//        method(arr);
        Student stu = new Student();
        stu.setName("zhangsan");
        try {
            stu.setAge(-1);
        }catch (NullPointerException e){
            //处理异常
            System.out.println("空指针异常");
        }catch (MyException e){
            e.printStackTrace();
        }catch (Exception e){
            System.out.println("产生了异常！");
        }

        System.out.println(stu);
    }
    public static void method(int[] arrs){
        System.out.println(arrs[5]);
    }
}
